﻿<%@ WebHandler Language="C#" Class="xinxi_quanxian" %>

using System;
using System.Web;
using System.Data;
using KeaoBase;
using KeaoDataBase;
using Newtonsoft.Json;
using System.Configuration;
using System.Collections.Generic;

public class xinxi_quanxian : IHttpHandler {

    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        try
        {
            string uid = context.Request.QueryString["uid"];
            string kid = context.Request.QueryString["kid"];
            if (!Auth.UserLogined(uid, kid))
            {
                context.Response.Write("[]");
                return;
            }
            BaseDataBase m_DB = System.Reflection.Assembly.Load("KeaoDataBase").CreateInstance(string.Format("KeaoDataBase.{0}", ConfigurationManager.AppSettings["数据库类型"])) as BaseDataBase;
            if (!m_DB.InitDataBase(ConfigurationManager.ConnectionStrings["DataSource"].ConnectionString))
            {
                context.Response.Write("[]");
                return;
            }
            else
            {
                DataTable quanXianDt = m_DB.GetDataTableByCondition("tbl_quanxian");
                string jsonStr = JsonConvert.SerializeObject(quanXianDt);
                context.Response.Write(jsonStr);
            }
        }
        catch(Exception err)
        {
            KeaoUtils.LogTxt(string.Format("权限信息异常。{0}", err.Message));
                  context.Response.Write("请重试...");
        }
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}